$(function(){
    ym.ajax({
        url:"/DeclicateAskAnswer/selectChildMenu",
        success:function(data){
        	console.log(data);
            var html ="";
            var a = 0;
            for(var i=0;i<data.obj.length;i++){
                a++;
                if(a == 1){
                     html = '<li class="tabs font14 am-padding-sm color333 activ" id="'+data.obj[i].delicateMenuId+'">'+
                            '<img src="../img/'+data.obj[i].delicateMenuIco+'">'+
                             '<p>'+data.obj[i].delicateMenuName+'</p>'+
                            '</li>';
                }else{
                    html = '<li class="tabs font14 am-padding-sm color333" id="'+data.obj[i].delicateMenuId+'">'+
                        '<img src="../img/'+data.obj[i].delicateMenuIco+'">'+
                        '<p>'+data.obj[i].delicateMenuName+'</p>'+
                        '</li>';
                }
                $('.ulus').append(html);
            }
        }
    })

    var htmls = "";
     ym.ajax({
        url:"/DeclicateAskAnswer/queryChildMenuByParentId",
        param:{
            "parentId":"1"
        },
        success:function (data) {
            for(var i=0;i<data.obj.length;i++){
                 htmls = '<li class="'+data.obj[i].delicateMenuId+'">'+data.obj[i].delicateMenuName+'</li>';

                $('.lizi').append(htmls);
            }
            var fdsf = $('.lizi').html();
        }
    })

    $('body').on('click','.tabs',function(){
		$(this).addClass('activ').siblings().removeClass('activ');
		var id = $(this).attr('id');
        ym.ajax({
            url:"/DeclicateAskAnswer/queryChildMenuByParentId",
            param:{
                 "parentId":id
            },
            success:function (data) {
					console.log(data);
                    var htmls = "";
                    $('.lizi').html('');
                    for(var i=0;i<data.obj.length;i++){
                         htmls = '<li class="'+data.obj[i].delicateMenuId+'">'+data.obj[i].delicateMenuName+'</li>';
						$('.lizi').append(htmls);
                    }
				}
        })
		
	})
    
    $('body').on('click','.lizi>li',function(){
    	var delicateMenuId = $(this).attr('class');
    	console.log(delicateMenuId);
    	window.location.href = "problemList.html?delicateMenuId="+delicateMenuId;
    })
})
